package com.example.demo.util;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.example.demo.dao.SequenceMapper;

@Component
public class SequenceUtil {
	@Autowired
	SequenceMapper sequenceMapper;

	@Transactional
	public Long getId(String name) {
		Long id = sequenceMapper.getIncrementValue(name);
		sequenceMapper.updateCurrentValue(name);
		return id;
	}
}
